/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package job.manager.db.ec;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "UserGroups")
@NamedQueries({@NamedQuery(name = "UserGroupsEB.findAll", query = "SELECT u FROM UserGroupsEB u"), @NamedQuery(name = "UserGroupsEB.findById", query = "SELECT u FROM UserGroupsEB u WHERE u.id = :id"), @NamedQuery(name = "UserGroupsEB.findByGroupName", query = "SELECT u FROM UserGroupsEB u WHERE u.groupName = :groupName"), @NamedQuery(name = "UserGroupsEB.findByLevel", query = "SELECT u FROM UserGroupsEB u WHERE u.level = :level")})
public class UserGroupsEB implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "groupName")
    private String groupName;
    @Basic(optional = false)
    @Column(name = "level")
    private int level;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "usergroup")
    private Collection<UsersEB> usersEBCollection;

    public UserGroupsEB() {
    }

    public UserGroupsEB(Integer id) {
        this.id = id;
    }

    public UserGroupsEB(Integer id, String groupName, int level) {
        this.id = id;
        this.groupName = groupName;
        this.level = level;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public Collection<UsersEB> getUsersEBCollection() {
        return usersEBCollection;
    }

    public void setUsersEBCollection(Collection<UsersEB> usersEBCollection) {
        this.usersEBCollection = usersEBCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserGroupsEB)) {
            return false;
        }
        UserGroupsEB other = (UserGroupsEB) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "job.manager.db.ec.UserGroupsEB[id=" + id + "]";
    }

}
